package CalibrationUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author zelonghu
 * @name test_all_without_network
 * @class name：CalibrationUtils
 * @class 用于对标定数据的获取 to get the calibration data
 *        用于对标定数据和标定编号进行对应 to connect the calibrated data type(string) with symbol(int)
 *
 * @time 2019/4/21 9:25 PM
 * @change
 * @chang time
 * @class
 */
public class calibrationutils {
    private static List<Map<String,Integer>> calibrationstrlist = null;

    /**
     * @author zelonghu
     * @time 2019/4/21  9:28 PM
     * @describe 初始化一串标定数据集
     */
    public static List<Map<String,Integer>> initcalibrationList(){
        //获取标定的数据集 get the calibration data and symbol
        //a:此处只是用于测试构建，以后要根据实际情况改代码
        calibrationstrlist = new ArrayList<Map<String,Integer>>();
        Map<String,Integer> nm = new HashMap<>();
        nm.put("室内活动",-1);
        nm.put("上课",0);
        nm.put("下课",1);
        nm.put("睡觉",2);
        nm.put("吃饭",3);
        calibrationstrlist.add(nm);
        nm = new HashMap<>();
        nm.put("室外活动",8);
        nm.put("跑步",4);
        nm.put("游泳",5);
        nm.put("扔垃圾",6);
        nm.put("打台球",7);
        calibrationstrlist.add(nm);
        //a
        return calibrationstrlist;
    }

    /**
     * @author zelonghu
     * @time 2019/4/21  9:43 PM
     * @describe 返回指定组别的所有的String数组 return the String Array of the calibration data key
     *           用于构建spinner
     */
    public  static String[] getcalibrationkeyarray(int i){
        String[] str = new String[calibrationstrlist.get(i).size()];
        return  calibrationstrlist.get(i).keySet().toArray(str);

    }

    /**
     * @author zelonghu
     * @time 2019/4/21  9:44 PM
     * @describe 返回一个值对应的标定数值Symbol return the symbol of the key offerd
     */
    public static Integer getcalibrationSymbol(int i,String key){
        return calibrationstrlist.get(i).get(key);
    }
}
